package cn.ichiva.service;

import org.springframework.data.redis.core.SetOperations;

import java.util.Collection;
import java.util.List;
import java.util.Set;

public class SetService{
    private final SetOperations<String,String> set;

    public SetService(SetOperations<String, String> set) {
        this.set = set;
    }


    public Long add(String key, List<String> values) {
        return set.add(key, values.toArray(new String[0]));
    }

    public Long remove(String key, List<String> values) {
        return set.remove(key, values.toArray(new String[0]));
    }

    public String pop(String key) {
        return set.pop(key);
    }

    public List<String> pops(String key, long count) {
        return set.pop(key, count);
    }

    public Boolean move(String key, String value, String destKey) {
        return set.move(key, value, destKey);
    }

    public Long size(String key) {
        return set.size(key);
    }

    public Boolean isMember(String key, String o) {
        return set.isMember(key, o);
    }

    public Set<String> intersect(String key, String otherKey) {
        return set.intersect(key, otherKey);
    }

    public Set<String> intersects(String key, Collection<String> otherKeys) {
        return set.intersect(key, otherKeys);
    }

    public Set<String> intersectKeys(Collection<String> keys) {
        return set.intersect(keys);
    }

    public Long intersectAndStore(String key, String otherKey, String destKey) {
        return set.intersectAndStore(key, otherKey, destKey);
    }

    public Long intersectAndStores(String key, Collection<String> otherKeys, String destKey) {
        return set.intersectAndStore(key, otherKeys, destKey);
    }

    public Long intersectAndStoreKeys(Collection<String> keys, String destKey) {
        return set.intersectAndStore(keys, destKey);
    }

    public Set<String> union(String key, String otherKey) {
        return set.union(key, otherKey);
    }

    public Set<String> unions(String key, Collection<String> otherKeys) {
        return set.union(key, otherKeys);
    }

    public Set<String> unionKeys(Collection<String> keys) {
        return set.union(keys);
    }

    public Long unionAndStore(String key, String otherKey, String destKey) {
        return set.unionAndStore(key, otherKey, destKey);
    }

    public Long unionAndStores(String key, Collection<String> otherKeys, String destKey) {
        return set.unionAndStore(key, otherKeys, destKey);
    }

    public Long unionAndStoreKeys(Collection<String> keys, String destKey) {
        return set.unionAndStore(keys, destKey);
    }

    public Set<String> difference(String key, String otherKey) {
        return set.difference(key, otherKey);
    }

    public Set<String> differences(String key, Collection<String> otherKeys) {
        return set.difference(key, otherKeys);
    }

    public Set<String> differenceKeys(Collection<String> keys) {
        return set.difference(keys);
    }

    public Long differenceAndStore(String key, String otherKey, String destKey) {
        return set.differenceAndStore(key, otherKey, destKey);
    }

    public Long differenceAndStore(String key, Collection<String> otherKeys, String destKey) {
        return set.differenceAndStore(key, otherKeys, destKey);
    }

    public Long differenceAndStoreKeys(Collection<String> keys, String destKey) {
        return set.differenceAndStore(keys, destKey);
    }

    public Set<String> members(String key) {
        return set.members(key);
    }

    public String randomMember(String key) {
        return set.randomMember(key);
    }

    public Set<String> distinctRandomMembers(String key, long count) {
        return set.distinctRandomMembers(key, count);
    }

    public List<String> randomMembers(String key, long count) {
        return set.randomMembers(key, count);
    }
}
